home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / X11 / extensions / XInput.h < prev    next >
C/C++ Source or Header  |  2006-04-12  |  31KB  |  1,126 lines

  1. /* $Xorg: XInput.h,v 1.4 2001/02/09 02:03:23 xorgcvs Exp $ */
  2.  
  3. /************************************************************
  4.  
  5. Copyright 1989, 1998  The Open Group
  6.  
  7. Permission to use, copy, modify, distribute, and sell this software and its
  8. documentation for any purpose is hereby granted without fee, provided that
  9. the above copyright notice appear in all copies and that both that
  10. copyright notice and this permission notice appear in supporting
  11. documentation.
  12.  
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  19. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  20. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22.  
  23. Except as contained in this notice, the name of The Open Group shall not be
  24. used in advertising or otherwise to promote the sale, use or other dealings
  25. in this Software without prior written authorization from The Open Group.
  26.  
  27. Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
  28.  
  29.             All Rights Reserved
  30.  
  31. Permission to use, copy, modify, and distribute this software and its
  32. documentation for any purpose and without fee is hereby granted,
  33. provided that the above copyright notice appear in all copies and that
  34. both that copyright notice and this permission notice appear in
  35. supporting documentation, and that the name of Hewlett-Packard not be
  36. used in advertising or publicity pertaining to distribution of the
  37. software without specific, written prior permission.
  38.  
  39. HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  40. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  41. HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  42. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  43. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  44. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  45. SOFTWARE.
  46.  
  47. ********************************************************/
  48. /* $XFree86: xc/include/extensions/XInput.h,v 1.3 2001/12/14 19:53:28 dawes Exp $ */
  49.  
  50. /* Definitions used by the library and client */
  51.  
  52. #ifndef _XINPUT_H_
  53. #define _XINPUT_H_
  54.  
  55. #include <X11/Xlib.h>
  56. #include <X11/extensions/XI.h>
  57.  
  58. #define _deviceKeyPress        0
  59. #define _deviceKeyRelease    1
  60.  
  61. #define _deviceButtonPress    0
  62. #define _deviceButtonRelease    1
  63.  
  64. #define _deviceMotionNotify    0
  65.  
  66. #define _deviceFocusIn        0
  67. #define _deviceFocusOut        1
  68.  
  69. #define _proximityIn        0
  70. #define _proximityOut        1
  71.  
  72. #define _deviceStateNotify    0
  73. #define _deviceMappingNotify    1
  74. #define _changeDeviceNotify    2
  75.  
  76. #define FindTypeAndClass(d,type,_class,classid,offset) \
  77.     { int _i; XInputClassInfo *_ip; \
  78.     type = 0; _class = 0; \
  79.     for (_i=0, _ip= ((XDevice *) d)->classes; \
  80.      _i< ((XDevice *) d)->num_classes; \
  81.      _i++, _ip++) \
  82.     if (_ip->input_class == classid) \
  83.         {type =  _ip->event_type_base + offset; \
  84.          _class =  ((XDevice *) d)->device_id << 8 | type;}}
  85.  
  86. #define DeviceKeyPress(d,type,_class) \
  87.     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress)
  88.  
  89. #define DeviceKeyRelease(d,type,_class) \
  90.     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease)
  91.  
  92. #define DeviceButtonPress(d,type,_class) \
  93.     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress)
  94.  
  95. #define DeviceButtonRelease(d,type,_class) \
  96.     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease)
  97.  
  98. #define DeviceMotionNotify(d,type,_class) \
  99.     FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify)
  100.  
  101. #define DeviceFocusIn(d,type,_class) \
  102.     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn)
  103.  
  104. #define DeviceFocusOut(d,type,_class) \
  105.     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut)
  106.  
  107. #define ProximityIn(d,type,_class) \
  108.     FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn)
  109.  
  110. #define ProximityOut(d,type,_class) \
  111.     FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut)
  112.  
  113. #define DeviceStateNotify(d,type,_class) \
  114.     FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify)
  115.  
  116. #define DeviceMappingNotify(d,type,_class) \
  117.     FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify)
  118.  
  119. #define ChangeDeviceNotify(d,type,_class) \
  120.     FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
  121.  
  122. #define DevicePointerMotionHint(d,type,_class) \
  123.     { _class =  ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
  124.  
  125. #define DeviceButton1Motion(d,type,_class) \
  126.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
  127.  
  128. #define DeviceButton2Motion(d,type,_class) \
  129.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
  130.  
  131. #define DeviceButton3Motion(d,type,_class) \
  132.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
  133.  
  134. #define DeviceButton4Motion(d,type, _class) \
  135.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
  136.  
  137. #define DeviceButton5Motion(d,type,_class) \
  138.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
  139.  
  140. #define DeviceButtonMotion(d,type, _class) \
  141.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
  142.  
  143. #define DeviceOwnerGrabButton(d,type,_class) \
  144.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
  145.  
  146. #define DeviceButtonPressGrab(d,type,_class) \
  147.     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
  148.  
  149. #define NoExtensionEvent(d,type,_class) \
  150.     { _class =  ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
  151.  
  152. #define BadDevice(dpy,error) _xibaddevice(dpy, &error)
  153.  
  154. #define BadClass(dpy,error) _xibadclass(dpy, &error)
  155.  
  156. #define BadEvent(dpy,error) _xibadevent(dpy, &error)
  157.  
  158. #define BadMode(dpy,error) _xibadmode(dpy, &error)
  159.  
  160. #define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
  161.  
  162. /***************************************************************
  163.  *
  164.  * DeviceKey events.  These events are sent by input devices that
  165.  * support input class Keys.
  166.  * The location of the X pointer is reported in the coordinate
  167.  * fields of the x,y and x_root,y_root fields.
  168.  *
  169.  */
  170.  
  171. typedef struct 
  172.     {
  173.     int            type;         /* of event */
  174.     unsigned long  serial;       /* # of last request processed */
  175.     Bool           send_event;   /* true if from SendEvent request */
  176.     Display        *display;     /* Display the event was read from */
  177.     Window         window;       /* "event" window reported relative to */
  178.     XID            deviceid;
  179.     Window         root;         /* root window event occured on */
  180.     Window         subwindow;    /* child window */
  181.     Time           time;         /* milliseconds */
  182.     int            x, y;         /* x, y coordinates in event window */
  183.     int            x_root;       /* coordinates relative to root */
  184.     int            y_root;       /* coordinates relative to root */
  185.     unsigned int   state;        /* key or button mask */
  186.     unsigned int   keycode;      /* detail */
  187.     Bool           same_screen;  /* same screen flag */
  188.     unsigned int   device_state; /* device key or button mask */
  189.     unsigned char  axes_count;
  190.     unsigned char  first_axis;
  191.     int            axis_data[6];
  192.     } XDeviceKeyEvent;
  193.  
  194. typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
  195. typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
  196.  
  197. /*******************************************************************
  198.  *
  199.  * DeviceButton events.  These events are sent by extension devices
  200.  * that support input class Buttons.
  201.  *
  202.  */
  203.  
  204. typedef struct {
  205.     int           type;         /* of event */
  206.     unsigned long serial;       /* # of last request processed by server */
  207.     Bool          send_event;   /* true if from a SendEvent request */
  208.     Display       *display;     /* Display the event was read from */
  209.     Window        window;       /* "event" window reported relative to */
  210.     XID           deviceid;
  211.     Window        root;         /* root window that the event occured on */
  212.     Window        subwindow;    /* child window */
  213.     Time          time;         /* milliseconds */
  214.     int           x, y;         /* x, y coordinates in event window */
  215.     int           x_root;       /* coordinates relative to root */
  216.     int           y_root;       /* coordinates relative to root */
  217.     unsigned int  state;        /* key or button mask */
  218.     unsigned int  button;       /* detail */
  219.     Bool          same_screen;  /* same screen flag */
  220.     unsigned int  device_state; /* device key or button mask */
  221.     unsigned char axes_count;
  222.     unsigned char first_axis;
  223.     int           axis_data[6];
  224.     } XDeviceButtonEvent;
  225.  
  226. typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
  227. typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
  228.  
  229. /*******************************************************************
  230.  *
  231.  * DeviceMotionNotify event.  These events are sent by extension devices
  232.  * that support input class Valuators.
  233.  *
  234.  */
  235.  
  236. typedef struct 
  237.     {
  238.     int           type;        /* of event */
  239.     unsigned long serial;      /* # of last request processed by server */
  240.     Bool          send_event;  /* true if from a SendEvent request */
  241.     Display       *display;    /* Display the event was read from */
  242.     Window        window;      /* "event" window reported relative to */
  243.     XID           deviceid;
  244.     Window        root;        /* root window that the event occured on */
  245.     Window        subwindow;   /* child window */
  246.     Time          time;        /* milliseconds */
  247.     int           x, y;        /* x, y coordinates in event window */
  248.     int           x_root;      /* coordinates relative to root */
  249.     int           y_root;      /* coordinates relative to root */
  250.     unsigned int  state;       /* key or button mask */
  251.     char          is_hint;     /* detail */
  252.     Bool          same_screen; /* same screen flag */
  253.     unsigned int  device_state; /* device key or button mask */
  254.     unsigned char axes_count;
  255.     unsigned char first_axis;
  256.     int           axis_data[6];
  257.     } XDeviceMotionEvent;
  258.  
  259. /*******************************************************************
  260.  *
  261.  * DeviceFocusChange events.  These events are sent when the focus
  262.  * of an extension device that can be focused is changed.
  263.  *
  264.  */
  265.  
  266. typedef struct 
  267.     {
  268.     int           type;       /* of event */
  269.     unsigned long serial;     /* # of last request processed by server */
  270.     Bool          send_event; /* true if from a SendEvent request */
  271.     Display       *display;   /* Display the event was read from */
  272.     Window        window;     /* "event" window reported relative to */
  273.     XID           deviceid;
  274.     int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
  275.     int           detail;
  276.     /*
  277.      * NotifyAncestor, NotifyVirtual, NotifyInferior, 
  278.      * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
  279.      * NotifyPointerRoot, NotifyDetailNone 
  280.      */
  281.     Time                time;
  282.     } XDeviceFocusChangeEvent;
  283.  
  284. typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
  285. typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
  286.  
  287. /*******************************************************************
  288.  *
  289.  * ProximityNotify events.  These events are sent by those absolute
  290.  * positioning devices that are capable of generating proximity information.
  291.  *
  292.  */
  293.  
  294. typedef struct 
  295.     {
  296.     int             type;      /* ProximityIn or ProximityOut */        
  297.     unsigned long   serial;    /* # of last request processed by server */
  298.     Bool            send_event; /* true if this came from a SendEvent request */
  299.     Display         *display;  /* Display the event was read from */
  300.     Window          window;      
  301.     XID                deviceid;
  302.     Window          root;            
  303.     Window          subwindow;      
  304.     Time            time;            
  305.     int             x, y;            
  306.     int             x_root, y_root;  
  307.     unsigned int    state;           
  308.     Bool            same_screen;     
  309.     unsigned int    device_state; /* device key or button mask */
  310.     unsigned char   axes_count;
  311.     unsigned char   first_axis;
  312.     int             axis_data[6];
  313.     } XProximityNotifyEvent;
  314. typedef XProximityNotifyEvent XProximityInEvent;
  315. typedef XProximityNotifyEvent XProximityOutEvent;
  316.  
  317. /*******************************************************************
  318.  *
  319.  * DeviceStateNotify events are generated on EnterWindow and FocusIn 
  320.  * for those clients who have selected DeviceState.
  321.  *
  322.  */
  323.  
  324. typedef struct
  325.     {
  326. #if defined(__cplusplus) || defined(c_plusplus)
  327.     unsigned char    c_class;
  328. #else
  329.     unsigned char    class;
  330. #endif
  331.     unsigned char    length;
  332.     } XInputClass;
  333.  
  334. typedef struct {
  335.     int           type;
  336.     unsigned long serial;       /* # of last request processed by server */
  337.     Bool          send_event;   /* true if this came from a SendEvent request */
  338.     Display       *display;     /* Display the event was read from */
  339.     Window        window;
  340.     XID           deviceid;
  341.     Time          time;
  342.     int           num_classes;
  343.     char      data[64];
  344. } XDeviceStateNotifyEvent;    
  345.  
  346. typedef struct {
  347. #if defined(__cplusplus) || defined(c_plusplus)
  348.     unsigned char    c_class;
  349. #else
  350.     unsigned char    class;
  351. #endif
  352.     unsigned char    length;
  353.     unsigned char    num_valuators;
  354.     unsigned char    mode;
  355.     int                valuators[6];
  356. } XValuatorStatus;
  357.  
  358. typedef struct {
  359. #if defined(__cplusplus) || defined(c_plusplus)
  360.     unsigned char    c_class;
  361. #else
  362.     unsigned char    class;
  363. #endif
  364.     unsigned char    length;
  365.     short        num_keys;
  366.     char            keys[32];
  367. } XKeyStatus;
  368.  
  369. typedef struct {
  370. #if defined(__cplusplus) || defined(c_plusplus)
  371.     unsigned char    c_class;
  372. #else
  373.     unsigned char    class;
  374. #endif
  375.     unsigned char    length;
  376.     short        num_buttons;
  377.     char            buttons[32];
  378. } XButtonStatus;
  379.  
  380. /*******************************************************************
  381.  *
  382.  * DeviceMappingNotify event.  This event is sent when the key mapping,
  383.  * modifier mapping, or button mapping of an extension device is changed.
  384.  *
  385.  */
  386.  
  387. typedef struct {
  388.     int           type;
  389.     unsigned long serial;       /* # of last request processed by server */
  390.     Bool          send_event;   /* true if this came from a SendEvent request */
  391.     Display       *display;     /* Display the event was read from */
  392.     Window        window;       /* unused */
  393.     XID           deviceid;
  394.     Time          time;
  395.     int           request;      /* one of MappingModifier, MappingKeyboard,
  396.                                     MappingPointer */
  397.     int           first_keycode;/* first keycode */
  398.     int           count;        /* defines range of change w. first_keycode*/
  399. } XDeviceMappingEvent;
  400.  
  401. /*******************************************************************
  402.  *
  403.  * ChangeDeviceNotify event.  This event is sent when an 
  404.  * XChangeKeyboard or XChangePointer request is made.
  405.  *
  406.  */
  407.  
  408. typedef struct {
  409.     int           type;
  410.     unsigned long serial;       /* # of last request processed by server */
  411.     Bool          send_event;   /* true if this came from a SendEvent request */
  412.     Display       *display;     /* Display the event was read from */
  413.     Window        window;       /* unused */
  414.     XID           deviceid;
  415.     Time          time;
  416.     int           request;      /* NewPointer or NewKeyboard */
  417. } XChangeDeviceNotifyEvent;
  418.  
  419. /*******************************************************************
  420.  *
  421.  * Control structures for input devices that support input class
  422.  * Feedback.  These are used by the XGetFeedbackControl and 
  423.  * XChangeFeedbackControl functions.
  424.  *
  425.  */
  426.  
  427. typedef struct {
  428. #if defined(__cplusplus) || defined(c_plusplus)
  429.      XID            c_class;
  430. #else
  431.      XID            class;
  432. #endif
  433.      int            length;
  434.      XID            id;
  435. } XFeedbackState;
  436.  
  437. typedef struct {
  438. #if defined(__cplusplus) || defined(c_plusplus)
  439.     XID     c_class;
  440. #else
  441.     XID     class;
  442. #endif
  443.     int     length;
  444.     XID     id;
  445.     int     click;
  446.     int     percent;
  447.     int     pitch;
  448.     int     duration;
  449.     int     led_mask;
  450.     int     global_auto_repeat;
  451.     char    auto_repeats[32];
  452. } XKbdFeedbackState;
  453.  
  454. typedef struct {
  455. #if defined(__cplusplus) || defined(c_plusplus)
  456.     XID     c_class;
  457. #else
  458.     XID     class;
  459. #endif
  460.     int     length;
  461.     XID     id;
  462.     int     accelNum;
  463.     int     accelDenom;
  464.     int     threshold;
  465. } XPtrFeedbackState;
  466.  
  467. typedef struct {
  468. #if defined(__cplusplus) || defined(c_plusplus)
  469.     XID     c_class;
  470. #else
  471.     XID     class;
  472. #endif
  473.     int     length;
  474.     XID     id;
  475.     int     resolution;
  476.     int     minVal;
  477.     int     maxVal;
  478. } XIntegerFeedbackState;
  479.  
  480. typedef struct {
  481. #if defined(__cplusplus) || defined(c_plusplus)
  482.     XID     c_class;
  483. #else
  484.     XID     class;
  485. #endif
  486.     int     length;
  487.     XID     id;
  488.     int     max_symbols;
  489.     int     num_syms_supported;
  490.     KeySym  *syms_supported;
  491. } XStringFeedbackState;
  492.  
  493. typedef struct {
  494. #if defined(__cplusplus) || defined(c_plusplus)
  495.     XID     c_class;
  496. #else
  497.     XID     class;
  498. #endif
  499.     int     length;
  500.     XID     id;
  501.     int     percent;
  502.     int     pitch;
  503.     int     duration;
  504. } XBellFeedbackState;
  505.  
  506. typedef struct {
  507. #if defined(__cplusplus) || defined(c_plusplus)
  508.     XID     c_class;
  509. #else
  510.     XID     class;
  511. #endif
  512.     int     length;
  513.     XID     id;
  514.     int     led_values;
  515.     int     led_mask;
  516. } XLedFeedbackState;
  517.  
  518. typedef struct {
  519. #if defined(__cplusplus) || defined(c_plusplus)
  520.      XID            c_class;
  521. #else
  522.      XID            class;
  523. #endif
  524.      int            length;
  525.      XID        id;
  526. } XFeedbackControl;
  527.  
  528. typedef struct {
  529. #if defined(__cplusplus) || defined(c_plusplus)
  530.     XID     c_class;
  531. #else
  532.     XID     class;
  533. #endif
  534.     int     length;
  535.     XID     id;
  536.     int     accelNum;
  537.     int     accelDenom;
  538.     int     threshold;
  539. } XPtrFeedbackControl;
  540.  
  541. typedef struct {
  542. #if defined(__cplusplus) || defined(c_plusplus)
  543.     XID     c_class;
  544. #else
  545.     XID     class;
  546. #endif
  547.     int     length;
  548.     XID     id;
  549.     int     click;
  550.     int     percent;
  551.     int     pitch;
  552.     int     duration;
  553.     int     led_mask;
  554.     int     led_value;
  555.     int     key;
  556.     int     auto_repeat_mode;
  557. } XKbdFeedbackControl;
  558.  
  559. typedef struct {
  560. #if defined(__cplusplus) || defined(c_plusplus)
  561.     XID     c_class;
  562. #else
  563.     XID     class;
  564. #endif
  565.     int     length;
  566.     XID     id;
  567.     int     num_keysyms;
  568.     KeySym  *syms_to_display;
  569. } XStringFeedbackControl;
  570.  
  571. typedef struct {
  572. #if defined(__cplusplus) || defined(c_plusplus)
  573.     XID     c_class;
  574. #else
  575.     XID     class;
  576. #endif
  577.     int     length;
  578.     XID     id;
  579.     int     int_to_display;
  580. } XIntegerFeedbackControl;
  581.  
  582. typedef struct {
  583. #if defined(__cplusplus) || defined(c_plusplus)
  584.     XID     c_class;
  585. #else
  586.     XID     class;
  587. #endif
  588.     int     length;
  589.     XID     id;
  590.     int     percent;
  591.     int     pitch;
  592.     int     duration;
  593. } XBellFeedbackControl;
  594.  
  595. typedef struct {
  596. #if defined(__cplusplus) || defined(c_plusplus)
  597.     XID     c_class;
  598. #else
  599.     XID     class;
  600. #endif
  601.     int     length;
  602.     XID     id;
  603.     int     led_mask;
  604.     int     led_values;
  605. } XLedFeedbackControl;
  606.  
  607. /*******************************************************************
  608.  *
  609.  * Device control structures.
  610.  *
  611.  */
  612.  
  613. typedef struct {
  614.      XID            control;
  615.      int            length;
  616. } XDeviceControl;
  617.  
  618. typedef struct {
  619.      XID            control;
  620.      int            length;
  621.      int            first_valuator;
  622.      int            num_valuators;
  623.      int            *resolutions;
  624. } XDeviceResolutionControl;
  625.  
  626. typedef struct {
  627.      XID            control;
  628.      int            length;
  629.      int            num_valuators;
  630.      int            *resolutions;
  631.      int            *min_resolutions;
  632.      int            *max_resolutions;
  633. } XDeviceResolutionState;
  634.  
  635. /*******************************************************************
  636.  *
  637.  * An array of XDeviceList structures is returned by the 
  638.  * XListInputDevices function.  Each entry contains information
  639.  * about one input device.  Among that information is an array of 
  640.  * pointers to structures that describe the characteristics of 
  641.  * the input device.
  642.  *
  643.  */
  644.  
  645. typedef struct _XAnyClassinfo *XAnyClassPtr;
  646.  
  647. typedef struct _XAnyClassinfo {
  648. #if defined(__cplusplus) || defined(c_plusplus)
  649.     XID     c_class;
  650. #else
  651.     XID     class;
  652. #endif
  653.     int     length;
  654.     } XAnyClassInfo;
  655.  
  656. typedef struct _XDeviceInfo *XDeviceInfoPtr;
  657.  
  658. typedef struct _XDeviceInfo
  659.     {
  660.     XID                 id;        
  661.     Atom                type;
  662.     char                *name;
  663.     int                 num_classes;
  664.     int                 use;
  665.     XAnyClassPtr     inputclassinfo;
  666.     } XDeviceInfo;
  667.  
  668. typedef struct _XKeyInfo *XKeyInfoPtr;
  669.  
  670. typedef struct _XKeyInfo
  671.     {
  672. #if defined(__cplusplus) || defined(c_plusplus)
  673.     XID            c_class;
  674. #else
  675.     XID            class;
  676. #endif
  677.     int            length;
  678.     unsigned short      min_keycode;
  679.     unsigned short      max_keycode;
  680.     unsigned short      num_keys;
  681.     } XKeyInfo;
  682.  
  683. typedef struct _XButtonInfo *XButtonInfoPtr;
  684.  
  685. typedef struct _XButtonInfo {
  686. #if defined(__cplusplus) || defined(c_plusplus)
  687.     XID        c_class;
  688. #else
  689.     XID        class;
  690. #endif
  691.     int        length;
  692.     short     num_buttons;
  693.     } XButtonInfo;
  694.  
  695. typedef struct _XAxisInfo *XAxisInfoPtr;
  696.  
  697. typedef struct _XAxisInfo {
  698.     int     resolution;
  699.     int     min_value;
  700.     int     max_value;
  701.     } XAxisInfo;
  702.  
  703. typedef struct _XValuatorInfo *XValuatorInfoPtr;
  704.  
  705. typedef struct    _XValuatorInfo
  706.     {
  707. #if defined(__cplusplus) || defined(c_plusplus)
  708.     XID            c_class;
  709. #else
  710.     XID            class;
  711. #endif
  712.     int            length;
  713.     unsigned char       num_axes;
  714.     unsigned char       mode;
  715.     unsigned long       motion_buffer;
  716.     XAxisInfoPtr        axes;
  717.     } XValuatorInfo;
  718.  
  719.  
  720. /*******************************************************************
  721.  *
  722.  * An XDevice structure is returned by the XOpenDevice function.  
  723.  * It contains an array of pointers to XInputClassInfo structures.
  724.  * Each contains information about a class of input supported by the
  725.  * device, including a pointer to an array of data for each type of event
  726.  * the device reports.
  727.  *
  728.  */
  729.  
  730.  
  731. typedef struct {
  732.         unsigned char   input_class;
  733.         unsigned char   event_type_base;
  734. } XInputClassInfo;
  735.  
  736. typedef struct {
  737.         XID                    device_id;
  738.         int                    num_classes;
  739.         XInputClassInfo        *classes;
  740. } XDevice;
  741.  
  742.  
  743. /*******************************************************************
  744.  *
  745.  * The following structure is used to return information for the 
  746.  * XGetSelectedExtensionEvents function.
  747.  *
  748.  */
  749.  
  750. typedef struct {
  751.         XEventClass     event_type;
  752.         XID             device;
  753. } XEventList;
  754.  
  755. /*******************************************************************
  756.  *
  757.  * The following structure is used to return motion history data from 
  758.  * an input device that supports the input class Valuators.
  759.  * This information is returned by the XGetDeviceMotionEvents function.
  760.  *
  761.  */
  762.  
  763. typedef struct {
  764.         Time   time;
  765.         int    *data;
  766. } XDeviceTimeCoord;
  767.  
  768.  
  769. /*******************************************************************
  770.  *
  771.  * Device state structure.
  772.  * This is returned by the XQueryDeviceState request.
  773.  *
  774.  */
  775.  
  776. typedef struct {
  777.         XID        device_id;
  778.         int        num_classes;
  779.         XInputClass    *data;
  780. } XDeviceState;
  781.  
  782. /*******************************************************************
  783.  *
  784.  * Note that the mode field is a bitfield that reports the Proximity
  785.  * status of the device as well as the mode.  The mode field should
  786.  * be OR'd with the mask DeviceMode and compared with the values
  787.  * Absolute and Relative to determine the mode, and should be OR'd
  788.  * with the mask ProximityState and compared with the values InProximity
  789.  * and OutOfProximity to determine the proximity state.
  790.  *
  791.  */
  792.  
  793. typedef struct {
  794. #if defined(__cplusplus) || defined(c_plusplus)
  795.     unsigned char    c_class;
  796. #else
  797.     unsigned char    class;
  798. #endif
  799.     unsigned char    length;
  800.     unsigned char    num_valuators;
  801.     unsigned char    mode;
  802.     int                *valuators;
  803. } XValuatorState;
  804.  
  805. typedef struct {
  806. #if defined(__cplusplus) || defined(c_plusplus)
  807.     unsigned char    c_class;
  808. #else
  809.     unsigned char    class;
  810. #endif
  811.     unsigned char    length;
  812.     short        num_keys;
  813.     char            keys[32];
  814. } XKeyState;
  815.  
  816. typedef struct {
  817. #if defined(__cplusplus) || defined(c_plusplus)
  818.     unsigned char    c_class;
  819. #else
  820.     unsigned char    class;
  821. #endif
  822.     unsigned char    length;
  823.     short        num_buttons;
  824.     char            buttons[32];
  825. } XButtonState;
  826.  
  827. /*******************************************************************
  828.  *
  829.  * Function definitions.
  830.  *
  831.  */
  832.  
  833. _XFUNCPROTOBEGIN
  834.  
  835. extern int    XChangeKeyboardDevice(
  836.     Display*        /* display */,
  837.     XDevice*        /* device */
  838. );
  839.  
  840. extern int    XChangePointerDevice(
  841.     Display*        /* display */,
  842.     XDevice*        /* device */,
  843.     int            /* xaxis */,
  844.     int            /* yaxis */
  845. );
  846.  
  847. extern int    XGrabDevice(
  848.     Display*        /* display */,
  849.     XDevice*        /* device */,
  850.     Window        /* grab_window */,
  851.     Bool        /* ownerEvents */,
  852.     int            /* event count */,
  853.     XEventClass*    /* event_list */,
  854.     int            /* this_device_mode */,
  855.     int            /* other_devices_mode */,
  856.     Time        /* time */
  857. );
  858.  
  859. extern int    XUngrabDevice(
  860.     Display*        /* display */,
  861.     XDevice*        /* device */,
  862.     Time         /* time */
  863. );
  864.  
  865. extern int    XGrabDeviceKey(
  866.     Display*        /* display */,
  867.     XDevice*        /* device */,
  868.     unsigned int    /* key */,
  869.     unsigned int    /* modifiers */,
  870.     XDevice*        /* modifier_device */,
  871.     Window        /* grab_window */,
  872.     Bool        /* owner_events */,
  873.     unsigned int    /* event_count */,
  874.     XEventClass*    /* event_list */,
  875.     int            /* this_device_mode */,
  876.     int            /* other_devices_mode */
  877. );
  878.  
  879. extern int    XUngrabDeviceKey(
  880.     Display*        /* display */,
  881.     XDevice*        /* device */,
  882.     unsigned int    /* key */,
  883.     unsigned int    /* modifiers */,
  884.     XDevice*        /* modifier_dev */,
  885.     Window        /* grab_window */
  886. );
  887.  
  888. extern int    XGrabDeviceButton(
  889.     Display*        /* display */,
  890.     XDevice*        /* device */,
  891.     unsigned int    /* button */,
  892.     unsigned int    /* modifiers */,
  893.     XDevice*        /* modifier_device */,
  894.     Window        /* grab_window */,
  895.     Bool        /* owner_events */,
  896.     unsigned int    /* event_count */,
  897.     XEventClass*    /* event_list */,
  898.     int            /* this_device_mode */,
  899.     int            /* other_devices_mode */
  900. );
  901.  
  902. extern int    XUngrabDeviceButton(
  903.     Display*        /* display */,
  904.     XDevice*        /* device */,
  905.     unsigned int    /* button */,
  906.     unsigned int    /* modifiers */,
  907.     XDevice*        /* modifier_dev */,
  908.     Window        /* grab_window */
  909. );
  910.  
  911. extern int    XAllowDeviceEvents(
  912.     Display*        /* display */,
  913.     XDevice*        /* device */,
  914.     int            /* event_mode */,
  915.     Time        /* time */
  916. );
  917.  
  918. extern int    XGetDeviceFocus(
  919.     Display*        /* display */,
  920.     XDevice*        /* device */,
  921.     Window*        /* focus */,
  922.     int*        /* revert_to */,
  923.     Time*        /* time */
  924. );
  925.  
  926. extern int    XSetDeviceFocus(
  927.     Display*        /* display */,
  928.     XDevice*        /* device */,
  929.     Window        /* focus */,
  930.     int            /* revert_to */,
  931.     Time        /* time */
  932. );
  933.  
  934. extern XFeedbackState    *XGetFeedbackControl(
  935.     Display*        /* display */,
  936.     XDevice*        /* device */,
  937.     int*        /* num_feedbacks */
  938. );
  939.  
  940. extern void    XFreeFeedbackList(
  941.     XFeedbackState*    /* list */
  942. );
  943.  
  944. extern int    XChangeFeedbackControl(
  945.     Display*        /* display */,
  946.     XDevice*        /* device */,
  947.     unsigned long    /* mask */,
  948.     XFeedbackControl*    /* f */
  949. );
  950.  
  951. extern int    XDeviceBell(
  952.     Display*        /* display */,
  953.     XDevice*        /* device */,
  954.     XID            /* feedbackclass */,
  955.     XID            /* feedbackid */,
  956.     int            /* percent */
  957. );
  958.  
  959. extern KeySym    *XGetDeviceKeyMapping(
  960.     Display*        /* display */,
  961.     XDevice*        /* device */,
  962. #if NeedWidePrototypes
  963.     unsigned int    /* first */,
  964. #else
  965.     KeyCode        /* first */,
  966. #endif
  967.     int            /* keycount */,
  968.     int*        /* syms_per_code */
  969. );
  970.  
  971. extern int    XChangeDeviceKeyMapping(
  972.     Display*        /* display */,
  973.     XDevice*        /* device */,
  974.     int            /* first */,
  975.     int            /* syms_per_code */,
  976.     KeySym*        /* keysyms */,
  977.     int            /* count */
  978. );
  979.  
  980. extern XModifierKeymap    *XGetDeviceModifierMapping(
  981.     Display*        /* display */,
  982.     XDevice*        /* device */
  983. );
  984.  
  985. extern int    XSetDeviceModifierMapping(
  986.     Display*        /* display */,
  987.     XDevice*        /* device */,
  988.     XModifierKeymap*    /* modmap */
  989. );
  990.  
  991. extern int    XSetDeviceButtonMapping(
  992.     Display*        /* display */,
  993.     XDevice*        /* device */,
  994.     unsigned char*    /* map[] */,
  995.     int            /* nmap */
  996. );
  997.  
  998. extern int    XGetDeviceButtonMapping(
  999.     Display*        /* display */,
  1000.     XDevice*        /* device */,
  1001.     unsigned char*    /* map[] */,
  1002.     unsigned int    /* nmap */
  1003. );
  1004.  
  1005. extern XDeviceState    *XQueryDeviceState(
  1006.     Display*        /* display */,
  1007.     XDevice*        /* device */
  1008. );
  1009.  
  1010. extern void    XFreeDeviceState(
  1011.     XDeviceState*    /* list */
  1012. );
  1013.  
  1014. extern XExtensionVersion    *XGetExtensionVersion(
  1015.     Display*        /* display */,
  1016.     _Xconst char*    /* name */
  1017. );
  1018.  
  1019. extern XDeviceInfo    *XListInputDevices(
  1020.     Display*        /* display */,
  1021.     int*        /* ndevices */
  1022. );
  1023.  
  1024. extern void    XFreeDeviceList(
  1025.     XDeviceInfo*    /* list */
  1026. );
  1027.  
  1028. extern XDevice    *XOpenDevice(
  1029.     Display*        /* display */,
  1030.     XID            /* id */
  1031. );
  1032.  
  1033. extern int    XCloseDevice(
  1034.     Display*        /* display */,
  1035.     XDevice*        /* device */
  1036. );
  1037.  
  1038. extern int    XSetDeviceMode(
  1039.     Display*        /* display */,
  1040.     XDevice*        /* device */,
  1041.     int            /* mode */
  1042. );
  1043.  
  1044. extern int    XSetDeviceValuators(
  1045.     Display*        /* display */,
  1046.     XDevice*        /* device */,
  1047.     int*        /* valuators */,
  1048.     int            /* first_valuator */,
  1049.     int            /* num_valuators */
  1050. );
  1051.  
  1052. extern XDeviceControl    *XGetDeviceControl(
  1053.     Display*        /* display */,
  1054.     XDevice*        /* device */,
  1055.     int            /* control */
  1056. );
  1057.  
  1058. extern int    XChangeDeviceControl(
  1059.     Display*        /* display */,
  1060.     XDevice*        /* device */,
  1061.     int            /* control */,
  1062.     XDeviceControl*    /* d */
  1063. );
  1064.  
  1065. extern int    XSelectExtensionEvent(
  1066.     Display*        /* display */,
  1067.     Window        /* w */,
  1068.     XEventClass*    /* event_list */,
  1069.     int            /* count */
  1070. );
  1071.  
  1072. extern int XGetSelectedExtensionEvents(
  1073.     Display*        /* display */,
  1074.     Window        /* w */,
  1075.     int*        /* this_client_count */,
  1076.     XEventClass**    /* this_client_list */,
  1077.     int*        /* all_clients_count */,
  1078.     XEventClass**    /* all_clients_list */
  1079. );
  1080.  
  1081. extern int    XChangeDeviceDontPropagateList(
  1082.     Display*        /* display */,
  1083.     Window        /* window */,
  1084.     int            /* count */,
  1085.     XEventClass*    /* events */,
  1086.     int            /* mode */
  1087. );
  1088.  
  1089. extern XEventClass    *XGetDeviceDontPropagateList(
  1090.     Display*        /* display */,
  1091.     Window        /* window */,
  1092.     int*        /* count */
  1093. );
  1094.  
  1095. extern Status    XSendExtensionEvent(
  1096.     Display*        /* display */,
  1097.     XDevice*        /* device */,
  1098.     Window        /* dest */,
  1099.     Bool        /* prop */,
  1100.     int            /* count */,
  1101.     XEventClass*    /* list */,
  1102.     XEvent*        /* event */
  1103. );
  1104.  
  1105. extern XDeviceTimeCoord    *XGetDeviceMotionEvents(
  1106.     Display*        /* display */,
  1107.     XDevice*        /* device */,
  1108.     Time        /* start */,
  1109.     Time        /* stop */,
  1110.     int*        /* nEvents */,
  1111.     int*        /* mode */,
  1112.     int*        /* axis_count */
  1113. );
  1114.  
  1115. extern void    XFreeDeviceMotionEvents(
  1116.     XDeviceTimeCoord*    /* events */
  1117. );
  1118.  
  1119. extern void    XFreeDeviceControl(
  1120.     XDeviceControl*    /* control */
  1121. );
  1122.  
  1123. _XFUNCPROTOEND
  1124.  
  1125. #endif /* _XINPUT_H_ */
  1126.